Set a breakpoint in managed code
Comments:
This allows you to set a breakpoint in managed code for a method that has
already been JIT-compiled.
Step 1: Find the MethodDesc for a given function
0:003> !Name2EE basedebug.exe basedebug.MyMain.MyFunction
--------------------------------------
MethodDesc: 375080
Name: [DEFAULT] String basedebug.MyMain.MyFunction()
-----------------------
Step 2: Find the JIT-compiled address.
0:003> !DumpMD 375080
Method Name : [DEFAULT] String basedebug.MyMain.MyFunction()
MethodTable 375098
Module: 14ea50
mdToken: 06000002 (G:\Projects\VC\basedebug\bin\Debug\basedebug.exe)
Flags : 10
Method VA : 03122ff0
-or-
0:003> !u 375080
Normal JIT generated code
[DEFAULT] String basedebug.MyMain.MyFunction()
Begin 03122ff0, size 18
03122ff0 55 push ebp
03122ff1 8bec mov ebp,esp
03122ff3 50 push eax
03122ff4 56 push esi
03122ff5 33f6 xor esi,esi
03122ff7 8b05e800ba01 mov eax,[01ba00e8] ("MyFunction")
03122ffd 8bf0 mov esi,eax
03122fff eb00 jmp 03123001
03123001 8bc6 mov eax,esi
03123003 5e pop esi
03123004 8be5 mov esp,ebp
03123006 5d pop ebp
03123007 c3 ret
Note:
If you have a specific place within the function where you need to set a
breakpoint, use the u command.
Step 3: Set the breakpoint
0:003> bp 03122ff0